#include "../no_xiang_tu0.h"
#include <iostream>
using namespace std;
int main(){
    int m,n;
    cin>>m>>n;
    WeightedGraph_quan graph(m);
    int a,b,c;
    for(int i=0;i<n;i++){
        cin>>a>>b>>c;
        graph.addEdge(a-1,b-1,c);
    }
//graph.printGraph();
    graph.primMST();
}
